package com.penglecode.netty.service.impl;

import java.util.Arrays;
import java.util.List;
import java.util.Map;

import com.penglecode.netty.service.OrderService;
import com.penglecode.netty.service.model.OrderInfo;
import com.penglecode.netty.service.model.Result;

public class OrderServiceImpl implements OrderService {

	public OrderInfo getOrderInfo() {
		OrderInfo orderInfo = new OrderInfo();
		orderInfo.setMainOrderId("201307261257350000");
		orderInfo.setChildOrderId("201307261257350001");
		orderInfo.setOrderTime("2013-07-26 12:57:35");
		orderInfo.setProductId("P10001");
		orderInfo.setProductName("Iphone 5 16GB/港行/白色全场最低价");
		orderInfo.setBuyNum(1);
		orderInfo.setUnitPrice(4389.00);
		orderInfo.setExpressFee(20.0);
		orderInfo.setDiscount(1);
		return orderInfo;
	}
	
	public OrderInfo getOrderInfo(String childOrderId) {
		OrderInfo orderInfo = new OrderInfo();
		orderInfo.setMainOrderId("201307261257350000");
		orderInfo.setChildOrderId("201307261257350001");
		orderInfo.setOrderTime("2013-07-26 12:57:35");
		orderInfo.setProductId("P10001");
		orderInfo.setProductName("Iphone 5 16GB/港行/白色全场最低价");
		orderInfo.setBuyNum(1);
		orderInfo.setUnitPrice(4389.00);
		orderInfo.setExpressFee(20.0);
		orderInfo.setDiscount(1);
		return orderInfo;
	}

	public List<OrderInfo> getOrderInfo(String... childOrderIds) {
		OrderInfo orderInfo = new OrderInfo();
		orderInfo.setMainOrderId("201307261257350000");
		orderInfo.setChildOrderId("201307261257350001");
		orderInfo.setOrderTime("2013-07-26 12:57:35");
		orderInfo.setProductId("P10001");
		orderInfo.setProductName("Iphone 5 16GB/港行/白色全场最低价");
		orderInfo.setBuyNum(1);
		orderInfo.setUnitPrice(4389.00);
		orderInfo.setExpressFee(20.0);
		orderInfo.setDiscount(1);
		return Arrays.asList(orderInfo, orderInfo);
	}

	public Result<Object> createOrder(List<OrderInfo> orderList) {
		Result<Object> result = new Result<Object>();
		result.setSuccess(true);
		result.setRetCode("1");
		result.setMsg("创建订单成功!");
		result.setRetObj(null);
		return result;
	}

	public OrderInfo[] getOrderInfo(Map<String, Object> map, Integer size,
			double maxPrice) {
		OrderInfo orderInfo = new OrderInfo();
		orderInfo.setMainOrderId("201307261257350000");
		orderInfo.setChildOrderId("201307261257350001");
		orderInfo.setOrderTime("2013-07-26 12:57:35");
		orderInfo.setProductId("P10001");
		orderInfo.setProductName("Iphone 5 16GB/港行/白色全场最低价");
		orderInfo.setBuyNum(1);
		orderInfo.setUnitPrice(4389.00);
		orderInfo.setExpressFee(20.0);
		orderInfo.setDiscount(1);
		return new OrderInfo[]{orderInfo, orderInfo};
	}

}
